package cn.ac.siom.query.dao.impl;

import cn.ac.siom.query.dao.ITab_thesis_HotDAO;
import cn.ac.siom.query.vo.Tab_Thesis;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

@Repository
public class Itab_thesis_hotDAOImpl extends SqlSessionDaoSupport implements ITab_thesis_HotDAO {
    @Autowired
    public Itab_thesis_hotDAOImpl(SqlSessionFactory sqlSessionFactory){
        super.setSqlSessionFactory(sqlSessionFactory);
    }


    @Override
    public List<Tab_Thesis> find_list() throws SQLException {
        return super.getSqlSession().selectList("Tab_thesis_hotNS.find_list");
    }

    @Override
    public List<Tab_Thesis> findNo(Integer id) throws SQLException {
        Map<String, Integer> map= new HashMap<>();
        map.put("id",id);
        return super.getSqlSession().selectList("Tab_thesis_hotNS.findNo", map);
    }

    @Override
    public List<Tab_Thesis> findPage(Integer page_id) throws SQLException {
        Integer startRow=(page_id-1)*20;
        Integer endRow=(page_id-1)*20+20;
        Map map= new HashMap<>();
        map.put("startRow",startRow);
        map.put("endRow",endRow);
        return super.getSqlSession().selectList("Tab_thesis_hotNS.findPage", map);
    }

    @Override
    public Integer findCount() throws SQLException {
        return super.getSqlSession().selectOne("Tab_thesis_hotNS.findCount");
    }

    @Override
    public boolean update(Integer id) throws SQLException {
        return super.getSqlSession().update("Tab_thesis_hotNS.doUpdate",id)>0;
    }

    @Override
    public boolean doCreate(Tab_Thesis vo) throws SQLException {
        return false;
    }

    @Override
    public boolean doUpdate(Tab_Thesis vo) throws SQLException {
        return false;
    }

    @Override
    public boolean doRemove(Set<?> ids) throws SQLException {
        return false;
    }

    @Override
    public Tab_Thesis findById(Integer id) throws SQLException {
        return null;
    }

    @Override
    public List<Tab_Thesis> findAll() throws SQLException {
        return null;
    }

    @Override
    public List<Tab_Thesis> findAllBySplit(String column, String keyWord, Integer currentPage, Integer lineSize) throws SQLException {
        return null;
    }
}
